Skip to content

open and export: resolve a short unique session-ID prefix#315

Merged
jongio merged 2 commits into
mainfrom
idea/short-id-prefix
Jul 14, 2026
Merged

open and export: resolve a short unique session-ID prefix#315
jongio merged 2 commits into
mainfrom
idea/short-id-prefix

Conversation

@jongio

@jongio jongio commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Resolves short session-ID prefixes for open and export, like git short SHAs.

What changed

  • New Store.ResolveIDPrefix(ctx, prefix): exact full-ID match wins; a unique prefix expands to its full ID; an ambiguous prefix returns *AmbiguousIDPrefixError listing candidates; no match returns sql.ErrNoRows. LIKE wildcards are escaped and matched literally.
  • Wired into the default DB loaders (defaultOpenGetSession, defaultExportGetDetail) only, so command test seams stay unaffected.
  • Usage banner documents that <id> accepts a unique prefix.

Tests

  • 8 store-level tests: exact match, unique prefix, exact-wins-over-prefix, ambiguous, no match, empty, literal wildcard escaping, candidate cap.
  • TestPrintUsage_Output updated to drain the pipe concurrently (the banner grew past the Windows pipe buffer).

Verification

  • go build ./..., go vet ./..., go test ./... -count=1 all pass.
  • golangci-lint run reports 0 issues.
  • mage deadcode reports OK.

Closes #314

Accept a unique prefix of a session ID wherever open and export take a
full <id>, mirroring git short-SHA behavior. An exact full-ID match wins
outright; a unique prefix expands to its full ID; an ambiguous prefix is
rejected with the list of matching sessions.

Resolution lives in a new Store.ResolveIDPrefix and is wired into the
default DB loaders only, so the command test seams are unaffected. LIKE
wildcards in the prefix are escaped and matched literally. The usage
banner documents the new behavior.

Closes #314

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 13, 2026
@jongio jongio self-assigned this Jul 13, 2026
# Conflicts:
#	cmd/dispatch/main.go
#	cmd/dispatch/main_test.go
@jongio jongio merged commit 66f9da8 into main Jul 14, 2026
2 checks passed
@jongio jongio deleted the idea/short-id-prefix branch July 14, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

open and export: resolve a short unique session-ID prefix

1 participant